<?php

namespace app\admin\service;


use app\common\model\integral\IntegralProductClass;
use think\facade\Db;

class IntegralProductClassService extends BaseService
{

    public function __construct()
    {
        $this->model = new IntegralProductClass();
    }


    public function edit()
    {
        $data = request()->param();
        $id = getter($data, 'id', 0);

        if ($id == 0) {
            $pid = getter($data, 'pid', 0);
            if ($pid > 0) {
                return message('不允许创建三级分类...', false);
            }
        }


        $rowId = $this->model->edit($data);
        if ($rowId) {
            return message();
        }
        return message('错误', false);
    }



    public function getList()
    {

        $list = $this->model->page(PAGE, PERPAGE)->select();

        //获取数据总数
        $count = $this->model->count();

        //返回结果
        $message = array(
            "msg" => '操作成功',
            "code" => 0,
            "data" => $list,
            "count" => $count,
        );
        return $message;
    }


}